#include <iostream>
#include <vector>
using namespace std;

template<typename T>
void selection_sort(vector<T> &my_vector);

int main(int argc, char const *argv[]){
    //initial my_vector
    int my_array[10] = {1, 9, 45, 7, 15, -5, 2, 74, -27, 10};
    int my_array_length = sizeof(my_array)/sizeof(my_array[0]);
    vector<int> my_vector(my_array, my_array + my_array_length); 

    selection_sort(my_vector);
    for (int i = 0; i < my_vector.size(); i++)
        cout << my_vector[i] << ' ';
    cout << endl;
    return 0;
}

template<typename T>
void selection_sort(vector<T> &my_vector){
    T temp, smallest;
    int smallest_index;
    for (int i = 0; i < my_vector.size(); i++){
        smallest = my_vector[i];
        smallest_index = i;
        for (int j = i; j < my_vector.size(); j++){
            if(my_vector[j] < smallest){
                smallest = my_vector[j];
                smallest_index = j;
            }
        }
        temp = my_vector[i];
        my_vector[i] = smallest;
        my_vector[smallest_index] = temp;
    }
}
